/**
 * 正则匹配类
 * @desc 匹配返回true,不匹配返回false
 */
class RegEx {
  phone (phone) {
    return /^1[3|4|5|8][0-9]\d{8}$/.test(phone)
  }
  idCard (idCard) {
    return /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2]\d)|(3[0-1]))((\d{4})|(\d{3}[Xx]))$/.test(idCard)
  }
  webSource (webSource) {
    return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-,@?^=%&:/~#]*[\w\-?^=%&/~#])?/.test(webSource)
  }
}

const RegExService = new RegEx()
export default RegExService
